﻿using System.Collections.Generic;
using UnityEngine;

namespace Learning
{
    public class MapAreaPaintScript : MonoBehaviour
    {
        public List<Vector4> colors = new List<Vector4>();

        private Material mat;
        
        void Start()
        {
            colors.Add(new Vector4(0, 0, 0, 0));
            for (int i = 1; i < 512; i++)
            {
                if (i % 2 == 0)
                {
                    colors.Add(new Vector4(0, 1, 0, 1));
                }
                else
                {
                    colors.Add(new Vector4(1, 1, 0, 1));
                }
            }
            
            mat = GetComponent<MeshRenderer>().sharedMaterial;
        }

        void Update()
        {
            mat.SetVectorArray("_AreaPaintColor", colors);
        }
    }
}
